package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.MemberAskClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.member.dos.AskMessageDO;
import org.springframework.stereotype.Component;

/**
 * 会员咨询熔断fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:25
 **/
@Component
public class MemberAskClientFallbackFactory extends BaseFallbackFactory<MemberAskClientFeignImpl> {
    @Override
    protected MemberAskClientFeignImpl fallback() {
        return new MemberAskClientFallback();
    }

    /**
     * 会员咨询熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午3:40
     * @since v7.0
     */
    @Component
    public static class MemberAskClientFallback implements MemberAskClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public Integer getNoReplyCount(Long sellerId) {
            logger.error("卖家ID为" + sellerId + "获取未回复的咨询数量错误");
            return null;
        }

        @Override
        public void sendMessage(AskMessageDO askMessageDO) {
            logger.error("发送消息异常");
        }
    }
}
